package com.afdor.rws.event.driven.channel.rocketmq.config;

import com.afdor.rws.annotation.extension.Extension;
import com.afdor.rws.annotation.extension.SPI;
import com.afdor.rws.event.driven.channel.rocketmq.utils.RocketMqUtils;
import com.afdor.rws.event.driven.config.EventConsumerConfig;
import lombok.Data;
import lombok.NonNull;

/**
 * 消费者参数配置
 *
 * @author 悭梵
 * @date Created in 2018-12-28 14:44
 */
@Data
@SPI(RocketMqUtils.DEFAULT_COMPONENT_CONFIG_EXTENSION_NAME)
@Extension(value = RocketMqUtils.DEFAULT_COMPONENT_CONFIG_EXTENSION_NAME, scope = Extension.Scope.PROTOTYPE, interfaceClass = EventConsumerConfig.class)
public class RocketMqEventConsumerConfig extends EventConsumerConfig<RocketMqEventConfig> {
    /**
     * 消费者最小线程数量
     */
    private int consumerThreadMin = 1;
    /**
     * 消费者最大线程数量
     */
    private int consumerThreadMax = 5;

    public RocketMqEventConsumerConfig() {
    }

    public RocketMqEventConsumerConfig(@NonNull final RocketMqEventConfig eventConfig) {
        setEventConfig(eventConfig);
    }

    public String getNamesrvAddr() {
        return getEventConfig().getNamesrvAddr();
    }

    public int getDefaultTopicQueueNums() {
        return getEventConfig().getDefaultTopicQueueNums();
    }

    public boolean isOrderlyConsumer() {
        return getEventConfig().isOrderlyConsumer();
    }

}
